/**
 * 
 */
package com.md.model;

import java.util.TreeMap;

/**
 * @author yehao
 *
 */
public class Entity {

	private String tableName;

	private TreeMap<String, Property> propertyMap;

	public Entity(String tableName) {
		this.tableName = tableName;
		this.propertyMap = new TreeMap<>();
	}

	public void addProperty(Property property) {
		if (this.propertyMap.get(property.getName()) != null) {
			property.setPrimaryKey(true);
		}
		this.propertyMap.put(property.getName(), property);
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public TreeMap<String, Property> getPropertyMap() {
		return propertyMap;
	}

	public void setPropertyMap(TreeMap<String, Property> propertyMap) {
		this.propertyMap = propertyMap;
	}

}
